Skip to content

Conversation

@Sporiff
Copy link
Member

@Sporiff Sporiff commented Nov 22, 2025

Closes #2

Adds a JWT-based auth and refresh mechanism for protecting API endpoints.

  • /api/auth/login: the login endpoint. Needs no authentication.
  • /api/auth/refresh: the refresh token dispensing endpoint. Needs no authentication.

Users are verified in the system by login credentials when logging in, and by the combination of refresh token and username when requesting a refresh token.

The TTL of both refresh and access tokens may be set by the server admin in the .env file. By default, access tokens persist for one hour and refresh tokens persist for 7 days. Each time a request is made for a new access token, the access token's TTL is updated to avoid logging users out too frequently.

All web endpoints are protected by form-based login, and all API endpoints are protected by JWTs. User permissions (USER, ADMIN) are encoded either in the user's principle (for the web interface) or the JWT. Users may only access what they own or what is public, administrators will likely be given much more access.

@Sporiff Sporiff self-assigned this Nov 22, 2025
@Sporiff Sporiff linked an issue Nov 22, 2025 that may be closed by this pull request
@Sporiff Sporiff enabled auto-merge (squash) November 22, 2025 20:41
@Sporiff Sporiff merged commit ad80e5b into main Nov 22, 2025
1 check passed
@Sporiff Sporiff deleted the 2-add-basic-user-setupauthentication branch November 22, 2025 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add basic user setup/authentication

2 participants